home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / graphics / demo_01.bas next >
BASIC Source File  |  1999-09-16  |  2KB  |  56 lines

  1. function []=demo_01()
  2. //[]=demo_01() 
  3. //             
  4. //!
  5. rect_p=[-15,-15,15,15];
  6. plot2d(0,0,-1,"030"," ",rect_p);
  7. ok='no'
  8. while ok='no' then
  9.     mess='chose demo number: 1-4,0 to leave'
  10.     write(%io(2),mess,'(a,3x,$)')
  11.     n=read(%io(1),1,1,'(a1)')
  12.     select n
  13.        case '0' then ok='yes'
  14.        case '1' then
  15.                    xclear()
  16.                    plot2d(0,0,-1,"032"," ",rect_p)
  17.                    t=0:0.2:5
  18.                    for k=t,
  19.                     polygone([-5+1.5*k,-4+0.8*k],round(3+k),0.5+1.5*k,k);
  20.                    end
  21.       case '2' then
  22.                    xclear()
  23.                    plot2d(0,0,-1,"032"," ",rect_p)
  24.                    t=0:0.08:3*%pi; t=t(1:95);
  25.                    for k=t,rectang([-5+0.5*k,0],0.5+1.6*k,0.5+1.6*k,k);end
  26.       case '3' then
  27.                    xclear()
  28.                    plot2d(0,0,-1,"032"," ",rect_p)
  29.                    xy=[-3 0;-3 0]
  30.                    i=1
  31.                    for l=1:8
  32.                      xo=xy(:,i)
  33.                      for k=1:12,
  34.                        xy=rotate(xy,-0.1976,xo);
  35.                        xpoly(xy(1,:),xy(2,:),"lines",1);
  36.                      end
  37.                      if i=1 then i=2,else i=1,end
  38.                    end
  39.       case '4' then
  40.                    xclear()
  41.                    plot2d(0,0,-1,"032"," ",rect_p)
  42.                    xy=[-3 0;-3 0]
  43.                    i=1
  44.                    lseg=[];
  45.                    for l=1:8
  46.                      xo=xy(:,i)
  47.                      for k=1:12,
  48.                        xy=rotate(xy,-0.1976,xo);
  49.                        lseg=[lseg,xy];
  50.                      end
  51.                      if i=1 then i=2,else i=1,end
  52.                    end
  53.                    xsegs(lseg(1,:),lseg(2,:));
  54.     end
  55. end
  56.